package cn.maxwell.block;

import cn.maxwell.User;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 限流方式二，全局限流法，在调用时该方法明要与usercontroller注解中：blockHandler="exceptionHandler"中方法名一致
 */
public class UserBlock {
    public static User exceptionHandler(@PathVariable("id") Long id, BlockException e){
        e.printStackTrace();
        User user = new User(-1, "我已经被限流了", "你丫别点了！我都已经瓦了！！！");
        return user;
    }
}
